<template>
  <div class="app-container">
    <div class="unit-zong">
      <!-- 左侧部分 -->
      <div class="unit-left">
        <div class="unit-tops">
          共
          <span class="unit-red">{{total}}</span>个管理团队
        </div>
        <div class="unit-scroll" v-loading='unitload'>
          <div class="unit-left-li unit-left-top">
            <div class="unit-zong-txt" :class="{'active':zonggs.id == actid}" @click="viewInfo(zonggs.id)"> {{zonggs.displayName}}</div>

            <!-- <div class="changebtn" v-if="util.hasRule('Pages.Administration.OrganizationUnits.Edit')&&zonggs.createOrganzationType == '1'">
              <i class="iconfont icon-xiala"></i>
              <div class="dropdown">
                <p @click="addUnit(zonggs.id)">新建管理团队</p>
              </div>
            </div> -->
          </div>
          <div v-for="item in data" :key="item.id">
            <treedi :model="item" :hasrule="util.hasRule('Pages.Administration.OrganizationUnits.Edit')" :parentid="parentId" :actid="actid" :addNew="addUnit" :commands="handleTree" :viewInfo="viewInfo"></treedi>
          </div>
        </div>
      </div>
      <!--  右侧部分   :class="{'teamshow':teamshow}"-->
      <div class="unit-right">
        <!--管理团队详情-->
        <div class="unit-guanli" v-show="!guanli">
          <div class="unit-rtop">
            <div class="unit-toptop">
              <span class="unit-topbiao">
                <i class="iconfont icon-organization"></i> {{mingxi.displayName}}</span>
              <span class="unit-status" v-if="mingxi.isActive">正常</span>
              <span class="unit-status unit-false" v-else>已撤销</span>
              <div class="unit-edit">
                <el-dropdown v-if="util.hasRule('Pages.Administration.OrganizationUnits.Edit')" split-button @command="handleCommand" type="primary" size="mini" @click='toEdit()' class="el-btn-edit">

                  <i class="el-icon-edit-outline"></i> 编辑
                  <el-dropdown-menu slot="dropdown">

                    <el-dropdown-item command="1" v-if="mingxi.isActive&& mingxi.parentId !==null">
                      <div class="drop-text">撤销此机构</div>
                    </el-dropdown-item>
                    <el-dropdown-item command="2" v-if="!mingxi.isActive">
                      <div class="drop-text">恢复此机构</div>
                    </el-dropdown-item>
                    <el-dropdown-item command="3" v-if="mingxi.createChildOrganzation">
                      <div class="drop-text">新建管理团队</div>
                    </el-dropdown-item>
                    <el-dropdown-item command="5" v-if="mingxi.hadCreateBusOrganzation">
                      <div class="drop-text">新建业务团队</div>
                    </el-dropdown-item>
                    <el-dropdown-item command="4" divided v-if="mingxi.ifAllowDel && mingxi.parentId !==null">
                      <div class="drop-text">删除</div>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </div>
            </div>

            <div class="unit-cent">
              <div class="unit-row">
                <div class="unit-text">
                  <div class="unit-label">
                    上级机构：
                  </div>
                  <div class="unit-info">
                    {{mingxi.parentDisplayName?mingxi.parentDisplayName:'-'}}
                  </div>
                </div>
                <div class="unit-text">
                  <div class="unit-label">
                    机构类型：
                  </div>
                  <div class="unit-info">
                    {{mingxi.businessTypeName?mingxi.businessTypeName:'-'}}

                  </div>
                </div>
              </div>
              <div class="unit-row">
                <div class="unit-text">
                  <div class="unit-label">
                    负&ensp;责&ensp;人：
                  </div>
                  <div class="unit-info">
                    {{mingxi.charger?mingxi.charger:'-'}}
                  </div>
                </div>
                <div class="unit-text">
                  <div class="unit-label">
                    联系电话：
                  </div>
                  <div class="unit-info">
                    {{mingxi.phoneNumber?mingxi.phoneNumber:'-'}}
                  </div>
                </div>
              </div>
              <div class="unit-row">
                <div class="unit-text">
                  <div class="unit-label">
                    机构地址：
                  </div>
                  <div class="unit-info">
                    {{mingxi.address?mingxi.address:'-'}}
                  </div>
                </div>
                <div class="unit-text">
                  <div class="unit-label">
                    机构编码：
                  </div>
                  <div class="unit-info">
                    {{mingxi.organizationCode?mingxi.organizationCode :'-'}}
                  </div>
                </div>
              </div>
              <div class="unit-remark">
                备注：{{mingxi.remarks?mingxi.remarks:'-'}}
              </div>
            </div>
          </div>
          <div class="unit-rbottom">
            <div class="unit-tabs clearfix">
               <div v-if="mingxi.hadCreateBusOrganzation" class="unit-tabsli" :class="{'unit-tabs-act':tab == '2'}" v-on:click="clickone('2')">
                业务团队 (
                <span>{{mingxi.businessTeamCount}}</span> )
              </div>
              <div class="unit-tabsli" :class="{'unit-tabs-act':tab == '1'}" v-on:click="clickone('1')">
                直属人员 (
                <span>{{mingxi.memberCount}}</span> )
              </div>
             
              <div class="unit-tabsli" :class="{'unit-tabs-act':tab == '3'}" v-on:click="clickone('3')">
                出单工号 (
                <span>{{mingxi.staffCount}}</span> )
              </div>
            </div>
            <div class="unit-rbotext">
              <div class="unit-rbotext1" v-show="tab == '3'">
                <div class="unit-rbotextsou clearfix">
                  <div class="unit-search">
                    <el-select v-model="search1" placeholder="请选择保险公司" class='wd230' size='mini' @change='gonghaolist()'>
                      <el-option-group v-for="group in items" :key="group.letter" :label="group.letter">
                        <el-option v-for="item in group.insurances" :key="item.id" :label="item.insuranceName" :value="item.id">
                        </el-option>
                      </el-option-group>
                    </el-select>
                  </div>
                </div>
                <div class="unit-tbox">
                  <el-table :data="list" width="100%" size='small' element-loaditext="Loading" :stripe='true' v-loading='load'>
                    <el-table-column prop="insuranceName" label="保险公司" width="200">
                    </el-table-column>
                    <el-table-column prop="staffAccountName" label="工号">
                    </el-table-column>
                    <el-table-column label="描述">
                      <template slot-scope="scope">
                        <span>{{scope.row.describe}}</span>
                      </template>
                    </el-table-column>
                    <el-table-column label="操作" width="140" prop="id" align="right">
                      <template slot-scope="scope">
                        <!-- <a class="oper-a" click="handleClick(scope.row)">查看</a> -->
                        <router-link tag="a" target="_blank" :to="{ name: 'staffedit', params: { id: scope.row.id}}">
                          <a class="links" type="text">编辑</a>
                        </router-link>

                      </template>
                    </el-table-column>
                  </el-table>
                  <el-pagination @current-change="gonghaoChange" :current-page='gonghaoCurrent' background :page-size="10" layout="total,prev, pager, next" :total="gonghaoPage" class='unit-page'></el-pagination>

                </div>
              </div>
              <div class="unit-rbotext1" v-show="tab == '1'">
                <div class="unit-rbotextsou clearfix">
                  <div class="unit-search">
                    <el-input size="mini" class="wd230" placeholder="请输入内容" v-model='userSearch' @keyup.enter.native="search2"></el-input>
                  </div>
                  <el-button size="mini" type="primary" v-on:click='search2()' class='unit-sbtn'>搜索</el-button>
                  <!-- <el-button size="mini" icon="iconfont icon-xinjian" class='unit-gl' @click='add()'>添加用户</el-button> -->
                  <el-button size="mini"  type="primary" icon="el-icon-plus" class='unit-gl' @click='yonghuAdd(mingxi.id)'>新建人员</el-button>
                </div>
                <div class="unit-tbox">
                  <el-table :data="chartow" width="100%" size='small' element-loaditext="Loading" v-loading='load'>
                    <el-table-column prop="userName" label="登录名">
                    </el-table-column>
                    <el-table-column prop="name" label="姓名" width="180">
                    </el-table-column>
                    <el-table-column prop="roleName" label="角色">
                      <template slot-scope="scope">
                        <span v-if="scope.row.roleName==null || scope.row.roleName == ''">-</span>
                        <span v-else>{{scope.row.roleName}}</span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="isActive" label="状态" width="100">
                      <template slot-scope="scope">
                        <div v-if="scope.row.isActive">
                          <i class="icon iconfont icon-icon01" style="color:#389E0D"></i>正常</div>
                        <div v-if="!scope.row.isActive">
                          <i class="icon iconfont icon-icon01" style="color:#CF1322"></i>撤销</div>
                      </template>
                    </el-table-column>
                    <el-table-column label="操作" width="100" prop="id" align="right">
                      <template slot-scope="scope">
                        <!-- <a class="oper-a" click="handleClick(scope.row)">查看</a> -->

                        <a class="links" @click="userView(scope.row.id)" type="text">编辑</a>

                      </template>
                    </el-table-column>
                  </el-table>
                  <el-pagination @current-change="yonghuChange" :current-page='yonghuCurrent' background :page-size="10" layout="total,prev, pager, next" :total="yonghuPage" class='unit-page'></el-pagination>

                </div>
              </div>

              <!-- 直属团队详情 -->
              <div class="unit-rbotext1" v-show="tab == '2'">
                <div class="unit-rbotextsou clearfix">
                  <div class="unit-search">
                    <el-input size="mini" class="wd230" placeholder="按机构名称/负责人" v-model='userSearch' @keyup.enter.native="search3"></el-input>
                  </div>
                  <el-button size="mini" type="primary" v-on:click='search3()' class='unit-sbtn'>搜索</el-button>
                  <!--el-icon-plus-->
                  <el-button size="mini" v-if="mingxi.hadCreateBusOrganzation" type="primary" icon="el-icon-plus" class='unit-gl' @click='addyewu(mingxi.id)'>新建业务团队</el-button>
                  <!-- <el-button size="mini" v-else type="primary" icon="el-icon-plus" class='unit-gl' style="display:none;" @click='addyewu(mingxi.id)' >添加业务团队</el-button> -->
                </div>
                <div class="unit-tbox">
                  <el-table :data="yewu" width="100%" size='small' element-loaditext="Loading" v-loading='load'>
                    <el-table-column prop="displayName" label="机构名称">
                      <template slot-scope="scope">

                        <a class="links" @click="teamInfo(scope.row.id)">{{scope.row.displayName}}</a>

                      </template>
                    </el-table-column>
                    <el-table-column prop="organizationCode" label="机构编码" width="140">
                    </el-table-column>
                    <el-table-column prop="charger" label="负责人" width="120">
                    </el-table-column>
                     <el-table-column prop="phoneNumber" label="电话" width="120">
                    </el-table-column>
                    <el-table-column prop="isActive" label="状态" width="100">
                      <template slot-scope="scope">
                        <div v-if="scope.row.isActive">
                          <i class="icon iconfont icon-icon01" style="color:#389E0D"></i>正常</div>
                        <div v-if="!scope.row.isActive">
                          <i class="icon iconfont icon-icon01" style="color:#CF1322"></i>撤销</div>
                      </template>
                    </el-table-column>
                   
                    <el-table-column label="操作" width="100" prop="id" align="right">
                      <template slot-scope="scope">
                        <!-- <a class="links" @click="changeType(scope.row.id)" style="margin-right:10px;" v-if="!scope.row.isActive">启用</a> -->
                        <!-- <a class="links" @click="changeType(scope.row.id)" style="margin-right:10px;" v-else>撤销</a> -->
                        <a class="links" @click="teamInfo(scope.row.id)">详情</a>

                      </template>
                    </el-table-column>
                  </el-table>
                  <el-pagination @current-change="yewuChange" :current-page='yewuCurrent' background :page-size="10" layout="total,prev, pager, next" :total="yonghuPage2" class='unit-page'></el-pagination>

                </div>
              </div>
            </div>
          </div>
        </div>

        <!--业务团队详情-->
        <template v-if="childshow">
          <div class="unit-team" :class="{'team-show':visibility,'position':guanli}">
            <div class="unit-rtop">
              <div class="unit-toptop">
                <span class="unit-topbiao">
                  <i class="iconfont icon-organization"></i> {{mingxi.displayName}}</span>
                <i class="iconfont icon-right"></i>
                <span class="unit-teamname">{{yewuDetail.displayName}}</span>
                <div class="unit-edit">
                  <el-button class="mg15" size="mini" @click="backTeam">返回</el-button>
                  <el-dropdown v-if="util.hasRule('Pages.Administration.OrganizationUnits.Edit')" @click="edityewu" split-button @command="handleCommandyewu" type="primary" size="mini" class="el-btn-edit">

                    <i class="el-icon-edit-outline"></i> 编辑
                    <el-dropdown-menu slot="dropdown">

                      <el-dropdown-item command="1" v-if="yewuDetail.isActive&& mingxi.parentId !==null">
                        <div class="drop-text">撤销此机构</div>
                      </el-dropdown-item>
                      <el-dropdown-item command="2" v-if="!yewuDetail.isActive">
                        <div class="drop-text">恢复此机构</div>
                      </el-dropdown-item>
                      <!-- <el-dropdown-item command="3">
                        <div class="drop-text">新建子机构</div>
                      </el-dropdown-item> -->
                      <!-- <el-dropdown-item command="4" divided v-if="yewuDetail.ifAllowDel && yewuDetail.parentId !==null">
                        <div class="drop-text">删除</div>
                      </el-dropdown-item> -->
                    </el-dropdown-menu>
                  </el-dropdown>
                </div>
              </div>
              <!-- dialog -->
              <!-- <el-dialog :title="layerTitle" :visible.sync="dialogVisible" :close-on-click-modal='false' width='800px'>
                <el-form :model="formLabel" label-width="120px" :inline="true" ref="formLabel" :rules="rules">

                  <div>
                    <el-form-item label="上级组织机构：">
                      <ztree-select class="wd593" :treedata="units" :childprops="childprops" v-model="formLabel.parentId" :disabled="isnew == '2'" @change="unitChange"></ztree-select>
                    </el-form-item>
                    <el-form-item label="组织名称：" class="is-required" prop='displayName'>
                      <el-input v-model="formLabel.displayName" size="mini" class="wd230"></el-input>
                    </el-form-item>
                  </div>
                  <div>
                    <el-form-item label="组织机构简称：">
                      <el-input v-model="formLabel.abbreviation" size="mini" class="wd230"></el-input>
                    </el-form-item>
                    <el-form-item label="组织机构状态：">
                      <el-radio v-model="formLabel.isActive" :label='true'>正常</el-radio>
                      <el-radio v-model="formLabel.isActive" :label='false'>禁用</el-radio>
                    </el-form-item>
                  </div>
                  <div>
                    <el-form-item label="机构类型：">
                      <el-select v-model="formLabel.businessTypeId" placeholder="请选择" size="mini" class="wd230">
                        <el-option v-for="item in businessTypeNames" :key="item.key" :value="item.key" :label="item.value">
                        </el-option>
                      </el-select>
                    </el-form-item>
                  
                  </div>
                  <div>
                    <el-form-item label="所属区域：">
                      <el-cascader :options="options2" @active-item-change="handleItemChange" @change='getLastId' :props="props" v-model="formLabel.regionArr" size='mini' class="wd230"></el-cascader>
                    </el-form-item>
                    <el-form-item label="负责人：">
                      <el-input v-model="formLabel.charger" size="mini" class="wd230"></el-input>
                    </el-form-item>
                  </div>
                  <div>
                    <el-form-item label="组织机构地址：">
                      <el-input v-model="formLabel.address" size="mini" class="wdall"></el-input>
                    </el-form-item>
                  </div>
                  <div>
                    <el-form-item label="组织机构邮编：">
                      <el-input v-model="formLabel.zipCode" size="mini" class="wd230"></el-input>
                    </el-form-item>
                    <el-form-item label="组织机构电话：">
                      <el-input v-model="formLabel.phoneNumber" size="mini" class="wd230"></el-input>
                    </el-form-item>
                  </div>
                  <div>
                    <el-form-item label="备注：">
                      <el-input v-model="formLabel.remarks" size="mini" class="wdall"></el-input>
                    </el-form-item>
                  </div>
                </el-form>
                <div slot="footer" class="dialog-footer toCenter">
                  <el-button type="info" @click="closeDialog('formLabel')" size="mini"> &nbsp;&nbsp;取&nbsp;&nbsp;消&nbsp;&nbsp;</el-button>
                  <el-button type="primary" size='mini' @click="saveForm('formLabel')"> &nbsp;&nbsp;保&nbsp;&nbsp;&nbsp;存&nbsp;&nbsp; </el-button>
                </div>
              </el-dialog> -->
              <div class="unit-cent">
                <div class="unit-row">
                  <div class="unit-text">
                    <div class="unit-label">
                      机构类型：
                    </div>
                    <div class="unit-info">
                      {{yewuDetail.businessTypeName}}
                    </div>
                  </div>
                  <div class="unit-text">
                    <div class="unit-label">
                      状　　态：
                    </div>
                    <div class="unit-info">
                      <span class="unit-status" v-if="yewuDetail.isActive == true">正常</span>
                      <span class="unit-status unit-false" v-else>已撤销</span>
                    </div>
                  </div>
                </div>
                <div class="unit-row">
                  <div class="unit-text">
                    <div class="unit-label">
                      负 责 人：
                    </div>
                    <div class="unit-info">
                      {{yewuDetail.charger}}
                    </div>
                  </div>
                  <div class="unit-text">
                    <div class="unit-label">
                      联系电话：
                    </div>
                    <div class="unit-info">
                      {{yewuDetail.phoneNumber}}
                    </div>
                  </div>
                </div>
                <div class="unit-row">
                  <div class="unit-text">
                    <div class="unit-label">
                      身份证号：
                    </div>
                    <div class="unit-info">
                      {{yewuDetail.identityCard}}
                    </div>
                  </div>
                  <div class="unit-text">
                    <div class="unit-label">
                      电子邮箱：
                    </div>
                    <div class="unit-info">
                      {{yewuDetail.email?yewuDetail.email:'-'}}
                    </div>
                  </div>
                </div>
                 <div class="unit-row">
                  <div class="unit-text">
                    <div class="unit-label">
                      机构编码：
                    </div>
                    <div class="unit-info">
                      {{yewuDetail.organizationCode }}
                    </div>
                  </div>
                
                </div>
                <div class="unit-row">
                  <div class="unit-text">
                    <div class="unit-label">
                      负责人账号：
                    </div>
                    <div class="unit-info">
                      {{yewuDetail.chargerAccount}}
                    </div>
                  </div>
                  <div class="unit-text">
                    <div class="unit-label">
                      负责人密码：
                    </div>
                    <div class="unit-info">
                      <el-popover placement="bottom" width="280" v-model="onePwd" trigger="click" ref="fzrpsw">
                        <div class="unit-pwd">
                          <el-form :model="fzrForm" :inline="true" :rules="lusi" ref="fzrForm">
                            <el-form-item label="密　码: " prop='chargerNewPassword' style="margin-right:0">
                              <el-input class="wd180" size="mini" type="text" minlength="6" maxlength="18" v-model="fzrForm.chargerNewPassword"></el-input>
                            </el-form-item>
                            <el-form-item label="" style="margin-top:-10px;padding-left:55px;">
                              <el-checkbox v-model="fzrForm.chargerIstrue">首次登录修改初始密码</el-checkbox>
                            </el-form-item>
                            <div style="text-align: right; margin: 0">
                              <el-button size="mini" type="info" @click="canclePwd">取消</el-button>
                              <el-button type="primary" size="mini" @click="changePassword('fzrForm','fzrpsw')">确定</el-button>
                            </div>
                          </el-form>
                        </div>
                        <a class="editPwd" slot="reference">修改密码</a>
                      </el-popover>
                    </div>
                  </div>
                </div>
                <div class="unit-row" v-for="(obj,index) in recorderForm" :key="obj.id">
                  <div class="unit-text">
                    <div class="unit-label">
                      录单员账号：
                    </div>
                    <div class="unit-info">
                      {{obj.account}} &nbsp;&nbsp;
                      <a class="editPwd" @click="teamEdit(obj.id,yewuDetail.parentId)">编辑</a>
                    </div>
                  </div>
                  <div class="unit-text">
                    <div class="unit-label">
                      录单员密码：
                    </div>
                    <div class="unit-info">
                      <el-popover placement="bottom" width="280" :ref="'edit'+obj.id">
                        <div class="unit-pwd">
                          <el-form :model="ldyForm" :inline="true" :rules="lusi" ref="ldyForm">
                            <el-form-item label="密　码: " prop='chargerNewPassword' style="margin-right:0">
                              <el-input class="wd180" size="mini" type="text" v-model="ldyForm.chargerNewPassword" minlength="6" maxlength="18"></el-input>
                            </el-form-item>
                            <el-form-item label="" style="margin-top:-10px;padding-left:55px;">
                              <el-checkbox v-model="ldyForm.chargerIstrue">首次登录修改初始密码</el-checkbox>
                            </el-form-item>
                            <div style="text-align: right; margin: 0">
                              <el-button size="mini" type="info" @click="closePop('edit'+obj.id)">取消</el-button>
                              <el-button type="primary" size="mini" @click="ludanPassword('ldyForm','edit'+obj.id,index,obj.id)">确定</el-button>
                            </div>
                          </el-form>
                        </div>
                        <a class="editPwd" slot="reference">修改密码</a>
                      </el-popover>
                    </div>
                  </div>
                </div>
                <div class="unit-row">
                  <div clsss="team-add">
                    <a class="links" @click="teamAdd(yewuDetail.parentId)">添加录单员账号...</a>
                  </div>
                </div>
                <div class="unit-remark">
                  备注：{{yewuDetail.remarks?yewuDetail.remarks:'-'}}
                </div>
              </div>
            </div>
            <div class="unit-teamtitle clearfix">
              <div class="unit-tabsli">
                可用出单工号 (
                <span>{{yewuDetail.staffCount}}</span> )
              </div>
              <el-select v-model="useStaff" placeholder="按保险公司筛选" size='mini' @change='ywtafflist' class="unit-team-select">
                <el-option-group v-for="group in items" :key="group.letter" :label="group.letter">
                  <el-option v-for="item in group.insurances" :key="item.id" :label="item.insuranceName" :value="item.id">
                  </el-option>
                </el-option-group>
              </el-select>
            </div>
            <div class="unit-rbotext">
              <div class="unit-rbotext1">
                <div class="unit-tbox">
                  <el-table :data="yewuGhdata" width="100%" size='small' element-loaditext="Loading" :stripe='true' v-loading='kyload'>
                    <el-table-column prop="insuranceName" label="保险公司" width="200">
                    </el-table-column>
                    <el-table-column prop="staffAccountName" label="工号">

                    </el-table-column>
                    <el-table-column label="描述">
                      <template slot-scope="scope">
                        <span>{{scope.row.describe}}</span>
                      </template>
                    </el-table-column>
                    <el-table-column label="操作" width="140" prop="id" align="right">
                      <template slot-scope="scope">
                        <!-- <a class="oper-a" click="handleClick(scope.row)">查看</a> -->
                        <router-link tag="a" target="_blank"  :to="{ name: 'staffedit', params: { id: scope.row.id}}">
                          <a class="links" type="text">详情</a>
                        </router-link>

                      </template>
                    </el-table-column>
                  </el-table>
                  <el-pagination @current-change="ywghChange" :current-page='ywghCurrent' background :page-size="10" layout="total,prev, pager, next" :total="ywghPage" class='unit-page'></el-pagination>

                </div>
              </div>
            </div>
          </div>
        </template>

      </div>
    </div>
    <!--添加录单员账号dialog-->
    <el-dialog title="新建人员信息" :visible.sync="dialogAdd" :close-on-click-modal='false' @close="closeAdd" width="700px">
      <el-form :model="addForm" :inline="true" ref="addForm" :label-width="editLable" :rules="addRules">
        <el-row>
          <el-col :span="12">
            <el-form-item label="姓　　名:" class="is-required" prop="name">
              <el-input class="wd180" v-model="addForm.name" auto-complete="off" size="mini"></el-input>
            </el-form-item>
          </el-col>
         <el-col :span="12">
            <el-form-item label="机构编码:"  prop="organizationCode">
              <el-input class="wd180" v-model="addForm.organizationCode" auto-complete="off" size="mini"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="手 机 号:" class="is-required" prop="phoneNumber">
              <el-input class="wd180" v-model="addForm.phoneNumber" auto-complete="off" size="mini" minlength="11" maxlength="11"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电子邮箱:" prop="emailAddress">
              <el-input class="wd180" v-model="addForm.emailAddress" auto-complete="off" size="mini"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="身份证号:" prop="identityCard">
              <el-input class="wd180" v-model="addForm.identityCard" auto-complete="off" size="mini" minlength="15" maxlength="18"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="角　　色:" class="is-required">
              <el-input class="wd180" value="业务团队录单员" auto-complete="off" size="mini" disabled></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="所属机构:" class="is-required">
              <el-input disabled v-model="yewuDetail.displayName" size="mini" class="wd180"></el-input>
              <!-- <ztree-select class="wd180" disabled :treedata="units" :childprops="childprops" v-model="addForm.belongOrganizationUnitId" @change="unitChange"></ztree-select> -->
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="允许查看保单:" class="is-required" prop="policyPermission">
              <el-select v-model="addForm.policyPermission" placeholder="请选择" class="wd180" size="mini" disabled>
                <el-option size="mini" v-for="item in policyPermissionList" :key="item.id" :label="item.displayName" :value="item.id">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="账　　号:" class="is-required" prop="userName">
              <el-input class="wd180" v-model="addForm.userName" auto-complete="off" size="mini"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="密　　码:" class="is-required" prop="password">
              <el-input class="wd180" v-model="addForm.password" auto-complete="off" size="mini" minlength="6" maxlength="18"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label=" " prop="check">
              <el-checkbox v-model="addForm.shouldChangePasswordOnNextLogin">首次登录修改初始密码</el-checkbox>
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
      <div slot="footer" class="dialog-footer toCenter">
        <el-button @click="closeDialog('addForm')" size="small">取 消</el-button>
        <el-button type="primary" @click="CreateOrUpdateUser('addForm')" :loading="teamLoading" size="small">保 存</el-button>
        <!-- dialogAdd = false -->
      </div>
    </el-dialog>
    <!--编辑录单员账号dialog-->
    <el-dialog title="编辑人员信息" :visible.sync="dialogEdit" :close-on-click-modal='false' width="700px">
      <el-form :model="editForm" :inline="true" :rules="editRules" :label-width="editLable" ref="editForm">
        <el-row>
          <el-col :span="12">
            <el-form-item label="姓　　名:" class="is-required" prop="name">
              <el-input class="wd180" v-model="editForm.name" auto-complete="off" size="mini"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="状　　态:" class="is-required">
              <el-radio v-model="editForm.isActive" :label="true">正常</el-radio>
              <el-radio v-model="editForm.isActive" :label="false">禁用</el-radio>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="手 机 号:" class="is-required" prop="phoneNumber">
              <el-input class="wd180" v-model="editForm.phoneNumber" auto-complete="off" size="mini"  minlength="11"  maxlength="11"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电子邮箱:" prop="emailAddress">
              <el-input class="wd180" v-model="editForm.emailAddress" auto-complete="off" size="mini"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="身份证号:">
              <el-input class="wd180" v-model="editForm.identityCard" auto-complete="off" size="mini" minlength="15" maxlength="18"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="角　　色:" class="is-required">
              <el-input class="wd180" disabled value="业务团队录单员" auto-complete="off" size="mini"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="所属机构:" class="is-required" prop='belongOrganizationUnitId'>
              <el-input disabled v-model="yewuDetail.displayName" size="mini" class="wd180"></el-input>
              <!-- <ztree-select class="wd180" disabled :treedata="units" :childprops="childprops" v-model="editForm.belongOrganizationUnitId" @change="unitChange"></ztree-select> -->
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="允许查看保单:" class="is-required" prop="policyPermission">
              <el-select v-model="editForm.policyPermission" placeholder="请选择" class="wd180" size="mini" disabled>
                <el-option size="mini" v-for="item in policyPermissionList" :key="item.id" :label="item.displayName" :value="item.id">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
      <div slot="footer" class="dialog-footer toCenter">
        <el-button @click="closeDialog('editForm')" size="small">取 消</el-button>
        <el-button type="primary" @click="saveEdit('editForm')" size="small">保 存</el-button>
      </div>
    </el-dialog>
    <!--直属人员详情dialog-->
    <el-dialog title="人员编辑" :visible.sync="dialogUser" :close-on-click-modal='false' width="700px">
      <el-form :model="userForm" :inline="true" :rules="editRules" :label-width="editLable" ref="userForm">
        <el-row>
          <el-col :span="12">
            <el-form-item label="姓　　名:" class="is-required" prop="name">
              <el-input class="wd180" v-model="userForm.name" auto-complete="off" size="mini"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="状　　态:" class="is-required">
              <el-radio v-model="userForm.isActive" :label="true">正常</el-radio>
              <el-radio v-model="userForm.isActive" :label="false">禁用</el-radio>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="手 机 号:" class="is-required" prop="phoneNumber">
              <el-input class="wd180" v-model="userForm.phoneNumber" minlength="11" maxlength="11" auto-complete="off" size="mini"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电子邮箱:" prop="emailAddress">
              <el-input class="wd180" v-model="userForm.emailAddress" auto-complete="off" size="mini"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="身份证号:">
              <el-input class="wd180" v-model="userForm.identityCard" auto-complete="off" size="mini" minlength="15" maxlength="18"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="角　　色:" class="is-required">
              <div class="util-select">
                <el-select v-model="userForm.roleId" placeholder="请选择" class="wd180" size="mini">
                  <el-option size="mini" v-for="item in setRoleList" :key="item.id" :label="item.displayName" :value="item.id">
                  </el-option>
                </el-select>

              </div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="所属机构:" class="is-required" prop='belongOrganizationUnitId'>
              <ztree-select class="wd180" :treedata="units" :childprops="childprops" v-model="userForm.belongOrganizationUnitId" @change="unitChange"></ztree-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="允许查看保单:" class="is-required" prop="policyPermission">
              <el-select v-model="userForm.policyPermission" placeholder="请选择" class="wd180" size="mini">
                <el-option size="mini" v-for="item in policyPermissionList" :key="item.id" :label="item.displayName" :value="item.id">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
      <div slot="footer" class="dialog-footer toCenter">
        <el-button @click="closeDialog('userForm')" size="small">取 消</el-button>
        <el-button type="primary" @click="saveUser('userForm')" size="small" :loading="editLoading">保 存</el-button>
      </div>
    </el-dialog>

    <!-- 机构新建编辑dialog -->
    <el-dialog :title="layerTitle" :visible.sync="dialogVisible" :close-on-click-modal='false' width='700px' @close="closeJigou">
      <el-form :model="formLabel" label-width="105px" :inline="true" ref="formLabel" :rules="rules">
        <el-row>
          <el-col :span="13">
            <el-form-item label="机构名称：" class="is-required" prop='displayName'>
              <el-input v-model="formLabel.displayName" size="mini" class="wd180"></el-input>
            </el-form-item>
          </el-col>
         <el-col :span="11">
            <el-form-item label="机构编码：" prop='organizationCode'>
              <el-input v-model="formLabel.organizationCode" size="mini" class="wd180" minlength="11" maxlength="11"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="13">
            <template v-if="formLabel.parentId == null">
            <el-form-item label="上级机构：" >
              -
            </el-form-item>
            </template>
            <template v-else>
              <el-form-item label="上级机构：" class="is-required" prop='parentId'>
              <ztree-select class="wd180" disabled :treedata="units" :childprops="childprops" v-model="formLabel.parentId" @change="unitChange"></ztree-select>

            </el-form-item>
            </template>
           
          </el-col>
          <el-col :span="11">
            <el-form-item label="机构类型：" class="is-required">
              <el-input size="mini" value="管理团队" disabled class="wd180"></el-input>
              <!-- <el-select v-model="formLabel.businessType" placeholder="请选择" size="mini" class="wd180">
                  <el-option  value="138eca0c-d491-44d5-b684-7e243b41283a" label="管理团队">
                    </el-option>
                    <el-option v-for="item in businessTypeNames" :key="item.key" :value="item.key" :label="item.value">
                    </el-option>
                  </el-select> -->
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="13">
            <el-form-item label="负 责 人：">
              <el-input v-model="formLabel.charger" size="mini" class="wd180"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="联系电话：">
              <el-input v-model="formLabel.phoneNumber" minlength="11" maxlength="11" size="mini" class="wd180"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item label="机构地址：">
              <el-input v-model="formLabel.address" size="mini" class="wdall"></el-input>
            </el-form-item>
          </el-col>
           
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="备　　注：">
              <el-input v-model="formLabel.remarks" class="wdall ht56" type="textarea" :rows="2"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
      <div class="team-foot">
        <el-button type="info" @click="closeDialog('formLabel')" size="mini"> &nbsp;&nbsp;取&nbsp;&nbsp;消&nbsp;&nbsp;</el-button>
        <el-button type="primary" size='mini' @click="saveForm('formLabel')"> &nbsp;&nbsp;保&nbsp;&nbsp;&nbsp;存&nbsp;&nbsp; </el-button>
      </div>
    </el-dialog>
    <!--新建业务团队dialog-->
    <el-dialog title="新建业务团队" :visible.sync="dialogYewu" :close-on-click-modal='false' width='700px'>
      <el-form :model="formTeam" label-width="105px" :inline="true" ref="formTeam" :rules="teamRules">
        <el-row>
          <el-col :span="13">
            <el-form-item label="机构名称：" class="is-required" prop='displayName'>
              <el-input v-model="formTeam.displayName" size="mini" class="wd180"></el-input>
            </el-form-item>
          </el-col>
           <el-col :span="11">
            <el-form-item label="机构编码："  prop='organizationCode'>
              <el-input v-model="formTeam.organizationCode" size="mini" class="wd180" minlength="11" maxlength="11"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="13">
            <el-form-item label="上级机构：" class="is-required" prop='parentId'>
              <ztree-select class="wd180" disabled :treedata="units" :childprops="childprops" v-model="formTeam.parentId" @change="unitChange"></ztree-select>

            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="机构类型：">
              <el-input size="mini" value="业务团队" disabled class="wd180"></el-input>
              <!-- <el-select v-model="formTeam.businessType" placeholder="请选择" size="mini" class="wd180">
                  <el-option  value="138eca0c-d491-44d5-b684-7e243b41283a" label="管理团队">
                    </el-option>
                    <el-option v-for="item in businessTypeNames" :key="item.key" :value="item.key" :label="item.value">
                    </el-option>
                  </el-select> -->
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="13">
            <el-form-item label="负  责  人：" class="is-required" prop='charger'>
              <el-input v-model="formTeam.charger" size="mini" class="wd180"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="联系电话：" class="is-required" prop='phoneNumber'>
              <el-input v-model="formTeam.phoneNumber" size="mini" class="wd180" minlength="11" maxlength="11"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="13">
            <el-form-item label="身份证号：">
              <el-input v-model="formTeam.identityCard" size="mini" class="wd180" minlength="15" maxlength="18"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="电子邮箱：" prop="email">
              <el-input v-model="formTeam.email" size="mini" class="wd180"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="13">
            <el-form-item label="负责人账号：" class="is-required" prop='chargerAccount'>
              <el-input v-model="formTeam.chargerAccount" size="mini" class="wd180"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="负责人密码：" class="is-required" prop='chargerPassword'>
              <el-input v-model="formTeam.chargerPassword" size="mini" class="wd180" minlength="6" maxlength="18"></el-input>
            </el-form-item>
          </el-col>

        </el-row>
        <el-row>
          <el-col :span="13">
            <el-form-item label="录单员账号：" class="is-required" prop='recorderAccount'>
              <el-input v-model="formTeam.recorderAccount" size="mini" class="wd180"></el-input>
            </el-form-item>
          </el-col>
          
          <el-col :span="11">
            <el-form-item label="录单员密码：" class="is-required" prop='recorderPassword'>
              <el-input v-model="formTeam.recorderPassword" size="mini" class="wd180" minlength="6" maxlength="18"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row >
          
          <el-col :span="24">
            <el-form-item label=" " style="   margin-bottom:0;margin-top: -5px;float: right;position: relative;left: -80px; ">
              <el-checkbox v-model="formTeam.shouldChangePasswordOnNextLogin">首次登录是否需要改密码</el-checkbox>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="备　　注：">
              <el-input v-model="formTeam.remarks" class="wdall ht56" type="textarea" :rows="2"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        

      </el-form>
      <div class="team-foot">
        <el-button type="info" @click="closeDialog('formTeam')" size="mini"> &nbsp;&nbsp;取&nbsp;&nbsp;消&nbsp;&nbsp;</el-button>
        <el-button type="primary" size='mini' :loading="teamLoading" @click="saveTeam('formTeam')"> &nbsp;&nbsp;保&nbsp;&nbsp;&nbsp;存&nbsp;&nbsp; </el-button>
      </div>
    </el-dialog>

    <!--编辑业务团队dialog-->
    <el-dialog title="编辑业务团队" :visible.sync="bianjiyewu" :close-on-click-modal='false' width='700px'>
      <el-form :model="editDetail" label-width="105px" :inline="true" ref="editDetail" :rules="yewuRules">
        <el-row>
          <el-col :span="13">
            <el-form-item label="机构名称：" class="is-required" prop='displayName'>
              <el-input v-model="editDetail.displayName" size="mini" class="wd180"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="机构编码："  prop='organizationCode'>
              <el-input v-model="editDetail.organizationCode" size="mini" class="wd180" minlength="11" maxlength="11"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="13">
            <el-form-item label="上级机构：" class="is-required" prop='parentId'>
              <ztree-select class="wd180" disabled :treedata="units" :childprops="childprops" v-model="editDetail.parentId" @change="unitChange"></ztree-select>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="机构类型：">
              <el-input size="mini" value="业务团队" disabled class="wd180"></el-input>
              <!-- <el-select v-model="formTeam.businessType" placeholder="请选择" size="mini" class="wd180">
                  <el-option  value="138eca0c-d491-44d5-b684-7e243b41283a" label="管理团队">
                    </el-option>
                    <el-option v-for="item in businessTypeNames" :key="item.key" :value="item.key" :label="item.value">
                    </el-option>
                  </el-select> -->
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="13">
            <el-form-item label="负 责 人：" class="is-required" prop='charger'>
              <el-input v-model="editDetail.charger" size="mini" class="wd180"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="联系电话：" class="is-required" prop='phoneNumber'>
              <el-input v-model="editDetail.phoneNumber" size="mini" class="wd180" minlength="11" maxlength="11"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="13">
            <!-- class="is-required" prop='identityCard'-->
            <el-form-item label="身份证号：">
              <el-input v-model="editDetail.identityCard" size="mini" class="wd180" minlength="15" maxlength="18"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="电子邮箱：" prop="email">
              <el-input v-model="editDetail.email" size="mini" class="wd180"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="备　　注：">
              <el-input v-model="editDetail.remarks" class="wdall ht56" type="textarea" :rows="2"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
      <div class="team-foot">
        <el-button type="info" @click="closeDialog('editDetail')" size="mini"> &nbsp;&nbsp;取&nbsp;&nbsp;消&nbsp;&nbsp;</el-button>
        <el-button type="primary" size='mini' @click="saveEdityewu('editDetail')" :loading="editLoading"> &nbsp;&nbsp;保&nbsp;&nbsp;&nbsp;存&nbsp;&nbsp; </el-button>
      </div>
    </el-dialog>


        <!--直属添加账号dialog-->
    <el-dialog title="新建人员信息" :visible.sync="dialogZhiShu" :close-on-click-modal='false' width="700px">
      <el-form :model="zhiShuForm" label-width="105px" :inline="true" ref="zhiShuForm" :rules="addRules" >
        <el-row>
          <el-col :span="12">
            <el-form-item label="姓　　名:" class="is-required" prop="name">
              <el-input class="wd180" v-model="zhiShuForm.name" auto-complete="off" size="mini"></el-input>
            </el-form-item>
          </el-col>
         <el-col :span="12">
            <el-form-item label="状　　态:" class="is-required" prop="isActive">
              <el-radio v-model="zhiShuForm.isActive" :label="true">正常</el-radio>
              <el-radio v-model="zhiShuForm.isActive" :label="false">禁用</el-radio>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="手 机 号:" class="is-required" prop="phoneNumber">
              <el-input class="wd180" v-model="zhiShuForm.phoneNumber" auto-complete="off" size="mini" minlength="11"  maxlength="11"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电子邮箱:" prop="emailAddress">
              <el-input class="wd180" v-model="zhiShuForm.emailAddress" auto-complete="off" size="mini"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="身份证号:" prop="identityCard">
              <el-input class="wd180" v-model="zhiShuForm.identityCard" auto-complete="off" size="mini"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="角　　色:" class="is-required"  prop="assignedRoleIds">
             <div class="util-select">
                  <el-select v-model="zhiShuForm.assignedRoleIds" placeholder="请选择" class="wd180" size="mini" @change="console.log(val)">
                      <el-option size="mini" v-for="item in setRoleList" :key="item.id" :label="item.displayName" :value="item.id">
                      </el-option>
                  </el-select>
              </div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="所属机构:" class="is-required" prop='belongOrganizationUnitId'>
              <ztree-select class='wd180' v-model="zhiShuForm.belongOrganizationUnitId" :treedata="units" :childprops="childprops" ></ztree-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="允许查看保单:" class="is-required" prop="policyPermission">
              <el-select v-model="zhiShuForm.policyPermission" placeholder="请选择" class="wd180" size="mini">
                <el-option size="mini" v-for="item in policyPermissionList" :key="item.id" :label="item.displayName" :value="item.id">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="账　　号:" class="is-required" prop="userName">
              <el-input class="wd180" v-model="zhiShuForm.userName" auto-complete="off" size="mini"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="密　　码:" class="is-required" prop="password">
              <el-input class="wd180" v-model="zhiShuForm.password" auto-complete="off" size="mini"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label=" " prop="check">
              <el-checkbox v-model="zhiShuForm.shouldChangePasswordOnNextLogin">首次登录修改初始密码</el-checkbox>
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
      <div slot="footer" class="dialog-footer toCenter">
        <el-button @click="closeDialog('zhiShuForm')" size="small">取 消</el-button>
        <el-button type="primary" @click="CreateOrUpdateUser('zhiShuForm')" :loading="teamLoading" size="small">保 存</el-button>
        <!-- dialogAdd = false -->
      </div>
    </el-dialog>
  </div>

</template>

<script>
import Treedi from "@/components/Treedi";
import ztreeSelect from "@/components/z-select/index.vue";
import Vue from "vue";

export default {
  components: {
    Treedi,
    ztreeSelect
  },
  data() {
    var fuzeren = (rule, value, callback) => {
      if (!value || value == "") {
        return callback(new Error("请输入负责人账号"));
      } else if (
        this.formTeam.chargerAccount == this.formTeam.recorderAccount
      ) {
        return callback(new Error("负责人账号和录单员账号不能相等"));
      } else {
        this.post(
          { userName: value },
          "services/app/organizationUnit/ExistUserName"
        ).then(res => {
          if (res.success) {
            if (res.result) {
              return callback(new Error("负责人账号已存在"));
            } else {
              callback();
            }
          }
        });
        // if(this.ExistUserName(value)){
        //   return callback(new Error("负责人账号已存在"));
        // }
      }
    };
    var ludanyuan = (rule, value, callback) => {
      if (!value || value == "") {
        return callback(new Error("请输入账号"));
      } else if (
        this.formTeam.chargerAccount == this.formTeam.recorderAccount
      ) {
        return callback(new Error("负责人账号和录单员账号不能相等"));
      } else {
        this.post(
          { userName: value },
          "services/app/organizationUnit/ExistUserName"
        ).then(res => {
          if (res.success) {
            if (res.result) {
              return callback(new Error("录单员账号已存在"));
            } else {
              callback();
            }
          }
        });
      }
    };
    var zhanghao = (rule, value, callback) => {
      if (!value || value == "") {
        return callback(new Error("请输入账号"));
      } else {
        this.post(
          { userName: value },
          "services/app/organizationUnit/ExistUserName"
        ).then(res => {
          if (res.success) {
            if (res.result) {
              return callback(new Error("账号已存在"));
            } else {
              callback();
            }
          }
        });
      }
    };
    var codereg = (rule, value, callback) => {
     
        this.post(
          { organizationId :this.formLabel.id,
            organizationCode: value },
          "services/app/organizationUnit/IsExistOrganizationCode"
        ).then(res => {
          if (res.success) {
            if (res.result) {
              return callback(new Error("机构编码已存在"));
            } else {
              callback();
            }
          }
        });
   
    };
    var yewureg = (rule, value, callback) => {
     
        this.post(
          { organizationId :this.editDetail.id,
            organizationCode: value },
          "services/app/organizationUnit/IsExistOrganizationCode"
        ).then(res => {
          if (res.success) {
            if (res.result) {
              return callback(new Error("机构编码已存在"));
            } else {
              callback();
            }
          }
        });
   
    };
    var chargerPwd = (rule, value, callback) => {
      if (!value || value == "") {
        return callback(new Error("请输入6-18位数的密码"));
      }
      //var regx = /^[a-zA-Z0-9]{6,18}$/;
      var regx = /^\S{6,18}$/; //匹配非空字符

      if (!regx.test(value)) {
        callback(new Error("请输入6-18位数的密码"));
      } else {
        callback();
      }
    };
    var onlynumber = (rule, value, callback) => {
      var regx = /^[1][3,4,5,7,8][0-9]{9}$/g;
      if (regx.test(value)) {
        callback(new Error("请输入11位数字手机号"));
      } else {
        callback();
      }
    };
    var emailreg = (rule, value, callback) => {
      var regx = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
      console.log(value);
      if (regx.test(value) || !value) {
        callback();
      } else {
        callback(new Error("请输入正确格式的电子邮箱"));
      }
    };
    return {
      fzrForm: {
        chargerIstrue: true
      },
      ldyForm: {
        chargerIstrue: true
      },
      //数组子级相关参数
      childprops: {
        name: "displayName", //显示名字
        children: "organizationUnits", //子级字段名
        lv: "level" //当前层级
      },
      useStaff: "",
      yonghuCurrent: 1,
      gonghaoCurrent: 1,
      yewuCurrent: 1,
      ywghCurrent: 1,
      data: {},
      search1: "",
      userSearch: "",
      units: [],
      list: [], //工号列表数据
      chartow: [], //用户列表数据
      load: true,
      tab: "2",
      mingxi: {},
      unitsprops: {
        value: "id",
        children: "organizationUnits",
        label: "displayName"
      },
      zonggs: {},
      actid: null,
      status: [
        {
          isActive: true,
          value: "正常"
        },
        {
          isActive: false,
          value: "禁用"
        }
      ],
      dialogVisible: false, //dialog显示
      parentDisplayNames: [],
      businessTypeNames: [],
      policyTypeNames: [],
      parentDisplayName: [],
      formLabel: {
        isActive: true
      },
      rules: {
        displayName: [
          { required: true, message: "请输入组织名称", trigger: "blur" }
        ],
        parentId: [
          { required: true, message: "请选择上级机构", trigger: "change" }
        ],
        isActive: [
          { required: true, message: "请选择机构类型", trigger: "change" }
        ],
        businessType: [
          { required: true, message: "请选择机构状态", trigger: "change" }
        ],
         organizationCode : [
          { required: false, message: "请输入机构编码", trigger: "blur" },
          { validator: codereg, trigger: "blur" }
        ]
      },
      teamRules: {
        displayName: [
          { required: true, message: "请输入组织名称", trigger: "blur" }
        ],
        email: [{ validator: emailreg, trigger: "blur" }],
        businessType: [
          { required: true, message: "请选择机构状态", trigger: "change" }
        ],
        charger: [{ required: true, message: "请输入责任人", trigger: "blur" }],
        phoneNumber: [
          { required: true, message: "请输入联系电话", trigger: "blur" },
          {
              pattern:   /^\d{11}$/,
              message: '请输入11数字手机号'
          }
        ],
        identityCard: [
          { required: true, message: "请输入身份证号码", trigger: "blur" },
           {
              pattern:  /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
              message: '请输入正确的身份证号'
          }
        ],
        chargerAccount: [{ validator: fuzeren, trigger: "blur" }],
        chargerPassword: [
          { required: true, message: "请输入负责人密码", trigger: "blur" },
          { validator: chargerPwd, trigger: "blur" }
        ],
        recorderAccount: [{ validator: ludanyuan, trigger: "blur" }],
        recorderPassword: [
          { required: true, message: "请输入录单员密码", trigger: "blur" },
          { validator: chargerPwd, trigger: "blur" }
        ],
          organizationCode : [
          { required: false, message: "请输入机构编码", trigger: "blur" },
          { validator: codereg, trigger: "blur" }
        ]
      },
      addRules: {
        name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
        emailAddress: [{ validator: emailreg, trigger: "blur" }],
        isActive: [
          { required: true, message: "请选择状态", trigger: "change" }
        ],
        belongOrganizationUnitId: [
          { required: true, message: "请选择所属机构", trigger: "change" }
        ],
        phoneNumber: [
          { required: true, message: "请输入手机号", trigger: "blur" },
          {
              pattern:   /^\d{11}$/,
              message: '请输入11数字手机号'
          }
        ],
        userName: [{ validator: zhanghao, trigger: "blur" }],
        password: [{ validator: chargerPwd, trigger: "blur" }],
        policyPermission: [
          { required: true, message: "请选择允许查看保单", trigger: "change" }
        ],
          organizationCode : [
          { required: false, message: "请输入机构编码", trigger: "blur" },
          { validator: codereg, trigger: "blur" }
        ],
          identityCard: [
          { required: false, message: "请输入身份证号码", trigger: "blur" },
           {
              pattern:  /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
              message: '请输入正确的身份证号'
          }
        ],
         email:[
           { required: false, message: "请输入邮箱地址", trigger: "blur" },
            {
              pattern:  /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/,
              message: '请输入正确的邮箱地址'
          }
        ],
        assignedRoleIds:[
           { required: true, message: "请选择角色", trigger: "change" }
        ]
      },
      yewuRules: {
        name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
        emailAddress: [{ validator: emailreg, trigger: "blur" }],
        isActive: [
          { required: true, message: "请选择状态", trigger: "change" }
        ],
        belongOrganizationUnitId: [
          { required: true, message: "请选择所属机构", trigger: "change" }
        ],
        phoneNumber: [
          { required: true, message: "请输入手机号", trigger: "blur" },
          {
              pattern:   /^\d{11}$/,
              message: '请输入11数字手机号'
          }
        ],
        userName: [{ validator: zhanghao, trigger: "blur" }],
        password: [{ validator: chargerPwd, trigger: "blur" }],
        policyPermission: [
          { required: true, message: "请选择允许查看保单", trigger: "change" }
        ],
          organizationCode : [
          { required: false, message: "请输入机构编码", trigger: "blur" },
          { validator: yewureg, trigger: "blur" }
        ],
          identityCard: [
          { required: false, message: "请输入身份证号码", trigger: "blur" },
           {
              pattern:  /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
              message: '请输入正确的身份证号'
          }
        ],
         email:[
           { required: false, message: "请输入邮箱地址", trigger: "blur" },
            {
              pattern:  /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/,
              message: '请输入正确的邮箱地址'
          }
        ],
      },
      editRules: {
        name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
        emailAddress: [{ validator: emailreg, trigger: "blur" }],
        phoneNumber: [
          { required: true, message: "请输入手机号", trigger: "blur" },
          {
              pattern:   /^\d{11}$/,
              message: '请输入11数字手机号'
          }
        ],
           identityCard: [
          { required: false, message: "请输入身份证号码", trigger: "blur" },
           {
              pattern:  /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
              message: '请输入正确的身份证号'
          }
        ],
        policyPermission: [
          { required: true, message: "请选择允许查看保单", trigger: "change" }
        ],
          organizationCode : [
          { required: false, message: "请输入机构编码", trigger: "blur" },
          { validator: codereg, trigger: "blur" }
        ],
          identityCard: [
          { required: false, message: "请输入身份证号码", trigger: "blur" },
           {
              pattern:  /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
              message: '请输入正确的身份证号'
          }
        ],
      },
      lusi: {
        chargerNewPassword: [{ validator: chargerPwd, trigger: "blur" }]
      },
      editDetailrule: {
        email: [{ validator: emailreg, trigger: "blur" }]
      },
      //区域
      provices: [],
      cities: [],
      areas: [],
      //级联
      options2: [],
      props: {
        value: "key",
        label: "value",
        children: "children"
      },
      gonghaoPage: null,
      yonghuPage: null,
      yonghuPage2: null,
      ywghPage: null,
      layerParentId: null,
      baolist: [],
      layerTitle: "",
      isnew: "",
      total: "",
      items: [],
      yewu: [], //业务团队列表数据
      yewuDetail: {},
      chargerNewPassword: "", //负责人密码
      recorderNewPassword: "", //录单员密码
      chargerIstrue: true, //首次登陆修改密码
      recorderIstrue: true, //首次登陆修改密码
      childshow: false, //业务团队详情
      visibility: false,
      guanli: false,
      onePwd: false,
      twoPwd: false,
      dialogAdd: false, //新建录单员
      dialogEdit: false, //编辑录单员
      addForm: {
        isActive: true,
        shouldChangePasswordOnNextLogin: true
      }, //新建form
      editForm: {}, //编辑form
      zhiShuForm:{},
      addLable: "100px",
      editLable: "105px",
      unitload: true,
      dialogZhiShu:false,
      dialogYewu: false,
      formTeam: {},
      teamLoading: false,
      teamshow: false,
      bianjiyewu: false, //编辑业务团队
      recorderForm: {}, //业务团队录单员列表,
      policyPermissionList: [
        {
          id: 0,
          displayName: "仅查看自己的保单"
        },
        {
          id: 1,
          displayName: "查看所属机构的保单"
        },
        {
          id: 2,
          displayName: "查看所属机构和下级机构的保单"
        }
      ],
      editDetail: {},
      editLoading: false,
      popOver: false,
      yewuGhdata: [],
      kyload: false,
      yewuDetailID: "",
      detailIDOnly: "",
      dialogUser: false,
      userForm: {},
      setRoleList: []
    };
  },
  mounted() {
    this.loadUnits();
    // this.gonghaolist();
    // this.yonghulist();
    this.getUnits(); //获取组织机构下拉数据
    //this.getins(); //全部保险公司
    this.groupList();//全部保险公司带字幕
    this.GetList(); //获取工单数据
  },
  methods: {
    //保存
 
    toSave() {
      // this.dialogVisible = false;
      console.warn(this.formLabel);
      let isnew = this.isnew;
      let parentid = this.formLabel.parentId;
      let newLabel = {
        id: this.formLabel.id,
        displayName: this.formLabel.displayName,
        businessType: this.formLabel.businessType,
        remarks: this.formLabel.remarks,
        parentId: this.formLabel.parentId,
        charger: this.formLabel.charger,
        address: this.formLabel.address,
        phoneNumber: this.formLabel.phoneNumber,
        organizationCode : this.formLabel.organizationCode ,
        isActive:true
      };
        
      if (this.formLabel.displayName) {
        if (isnew == "1") {
          //1是新建
          this.post(
            newLabel,
            "services/app/organizationUnit/CreateOrganizationUnit"
          )
            .then(rs => {
              console.log("success");
              console.log(rs.result);
               
              
                //  this.getUnits();
              if (rs.success) {
                this.$notify({
                  title: "成功",
                  type: "success",
                  message: "新建成功",
                  customClass: "el-notification-success"
                });
                  this.loadUnits(parentid,rs.result);
                this.getUnits();
                this.dialogVisible = false;
              } else {
                this.$notify.error({
                  title: "错误",
                  message: rs.error.message
                });
              }
            })
            .catch(err => {
              this.$message.error(err.message);
            });
        } else {
          this.post(
            newLabel,
            "services/app/organizationUnit/UpdateOrganizationUnit"
          ).then(rs => {
            if (rs.success) {
              this.$notify({
                title: "成功",
                type: "success",
                message: "编辑成功",
                customClass: "el-notification-success"
              });
              this.loadUnits(parentid,newLabel.id);
              this.viewInfo(this.actid);
              this.dialogVisible = false;
            } else {
              this.$notify.error({
                title: "错误",
                message: rs.error.message
              });
            }
          });
        }
      }
    },
    // 验证
    saveForm(formName) {
      const that = this;
      this.$refs[formName].validate(valid => {
        if (valid) {
          this.toSave();
        } else {
          console.log("error submit");
          return false;
        }
      });
    //  this.toSave()
    },
    //级联
    handleItemChange(val) {
      console.log(val.length);
      const that = this;
      if (val.length == 1) {
        this.getCities(val);
      } else if (val.length == 2) {
        this.getAreas(val);
      }
    },
    getLastId(val) {
      this.formLabel.regionId = val[val.length - 1];
    },
    //操作回调
    handleCommand(command, pid) {
      console.log(command);
      let id = this.mingxi.id;
      let parentid = this.mingxi.parentId;
      let params = { id: id };
      if (command == "1") {
        this.$confirm("确定撤销此机构吗?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          this.post(
            params,
            "services/app/organizationUnit/UpdateOrganizationUnitState"
          ).then(rs => {
            if (rs.success) {
              this.mingxi = Object.assign({}, this.mingxi, {
                isActive: rs.result.isActive
              });
            }
          });
        });
      } else if (command == "2") {
        this.$confirm("确定恢复此机构吗?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          this.post(
            params,
            "services/app/organizationUnit/UpdateOrganizationUnitState"
          ).then(rs => {
            if (rs.success) {
              if (rs.success) {
                this.mingxi = Object.assign({}, this.mingxi, {
                  isActive: rs.result.isActive
                });
              }
            }
          });
        });
      } else if (command == "3") {
        this.addUnit(id);
      } else if (command == "4") {
        this.$confirm("确定删除该组织?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          this.post(
            params,
            "services/app/organizationUnit/DeleteOrganizationUnit"
          ).then(rs => {
            if (rs.success) {
              this.$notify({
                title: "成功",
                message: "删除成功",
                type: "success"
              });
              this.loadUnits("", parentid);
            }
          });
        });
      } else if (command == "5") {
        this.addyewu(this.mingxi.id);
      }
    },
    //操作回调
    handleCommandyewu(command, pid) {
      console.log(command);
      let id = this.yewuDetail.id;
      let params = { id: id };
      if (command == "1") {
        this.$confirm("确定撤销此机构吗?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          this.post(
            params,
            "services/app/organizationUnit/UpdateOrganizationUnitState"
          ).then(rs => {
            if (rs.success) {
              this.yewuDetail = Object.assign({}, this.yewuDetail, {
                isActive: rs.result.isActive
              });
            }
          });
        });
      } else if (command == "2") {
        this.$confirm("确定恢复此机构吗?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          this.post(
            params,
            "services/app/organizationUnit/UpdateOrganizationUnitState"
          ).then(rs => {
            if (rs.success) {
              if (rs.success) {
                this.yewuDetail = Object.assign({}, this.yewuDetail, {
                  isActive: rs.result.isActive
                });
              }
            }
          });
        });
      }
      //  else if (command == "4") {
      //   this.$confirm("确定删除该业务团队?", "提示", {
      //     confirmButtonText: "确定",
      //     cancelButtonText: "取消",
      //     type: "warning"
      //   }).then(() => {
      //     this.post(
      //       params,
      //       "services/app/organizationUnit/DeleteOrganizationUnit"
      //     ).then(rs => {
      //       if (rs.success) {
      //         this.$notify({
      //           title: "成功",
      //           message: "删除成功",
      //           type: "success"
      //         });
      //         this.loadUnits("", parentid);
      //       }
      //     });
      //   });
      // }
    },
    //操作回调
    handleTree(command, pid) {
      console.log(command);
      let id = this.mingxi.id;
      let params = { id: pid };
      
      if (command == "1") {
        this.post(
          params,
          "services/app/organizationUnit/UpdateOrganizationUnitState"
        ).then(rs => {
          if (rs.success) {
            this.mingxi = Object.assign({}, this.mingxi, {
              isActive: rs.result.isActive
            });
          }
        });
      } else if (command == "2") {
        this.post(
          params,
          "services/app/organizationUnit/UpdateOrganizationUnitState"
        ).then(rs => {
          if (rs.success) {
            if (rs.success) {
              this.mingxi = Object.assign({}, this.mingxi, {
                isActive: rs.result.isActive
              });
            }
          }
        });
      } else if (command == "3") {
        this.addUnit(pid);
        
      } else if (command == "4") {
        this.$confirm("确定删除该组织?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          this.post(
            params,
            "services/app/organizationUnit/DeleteOrganizationUnit"
          ).then(rs => {
            if (rs.success) {
              this.$notify({
                title: "成功",
                message: "删除成功",
                type: "success"
              });
              this.loadUnits();
              this.viewInfo(this.zonggs.id);
              console.log(1);
            } else {
              this.$notify.error({
                title: "错误",
                message: rs.error.message
              });
            }
          });
        });
      }
    },
    // 加载组织
    loadUnits(parentid, actid) {
      let params = {};
      this.post(
        params,
        "services/app/organizationUnit/GetOrganizationUnits"
      ).then(rs => {
        console.log(rs);

        if (rs.success) {
          let units = rs.result;
          //this.units = units;
          this.zonggs = units.organizationUnits[0];
          this.total = units.total;
          this.data = units.organizationUnits[0].organizationUnits;
          if (parentid) {
            this.parentId = parentid;
          } else {
            this.parentId = units.organizationUnits[0].id;
          }

          if (actid) {
            this.actid = actid;
            this.viewInfo(actid);
          } else {
            this.viewInfo(units.organizationUnits[0].id);
          }
          this.unitload = false;
        }
      });
    },
    // 详情
    viewInfo(val) {
       this.userSearch = ''
       this.loadrole();
      this.actid = val;
      const me = this;
      this.backTeam();
      let params = {
        id: val
      };
      this.post(
        params,
        "services/app/organizationUnit/GetOrganizationUnitsDetails"
      ).then(rs => {
        if (rs.success) {
          let datas = rs.result;
          let actid = datas.id;
          this.mingxi = datas;
          this.actid = actid;
          this.userid = this.mingxi.id; //选中的公司id

          if(!this.mingxi.hadCreateBusOrganzation){
            this.tab = "1";
          }else{
             this.tab = "2";
             this.yewulist(1)
          }
          
          //判断用户状态
          if (rs.result.isActive == true) {
            this.chexiaoba = "撤销此机构";
          } else {
            this.chexiaoba = "恢复此机构";
          }
          me.yonghulist(1, actid);
        //  me.loadrole();
        }
      });
    },
    //改变状态
    changeType(val){


      this.$confirm('确定要更改状态吗', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          closeOnClickModal:false,
          type: 'warning',
          center: true,
        }).then(() => {
            let id=obj.id
            const that = this;
            let params = {
                // id: that.staffList[index].id
                id: id,
            }
            this.post(params,'services/app/staff/UpdateStaffState').then(rs=>{
                console.log(rs);
                if(rs.success){
                  obj.isActive=rs.result.isActive;
                }
            })
        })




   
    },
    
    addUnit(val) {
      console.log(val);

      this.isnew = "1";
      this.layerTitle = "新建组织机构";
      // this.layerParentId = val;
      this.formLabel = Object.assign(
        {},
        {},
        {
          parentId: val,
          isActive: true,
          businessType: "138eca0c-d491-44d5-b684-7e243b41283a"
        }
      );
      this.dialogVisible = true;
      // this.layerParentId = this.searchCascader(this.units, val);

      console.warn(this.formLabel);
    },
    clickone(types) {
      //console.log('第一个亮')
      this.tab = types;
      if (types == "3") {
        //出单工号接口
        this.search1 = "";
        this.gonghaolist(1);
      } else if (types == "1") {
        //查询直属人员接口

        this.yonghulist(1);
      } else if (types == "2") {
        //直属业务团队接口

        this.yewulist(1);
      }
    },
    //出单工号接口方法
    gonghaolist(page, ids) {
      console.log("工号点击1111111111111");
      console.log(this.gongdanva);
      let gong = this.gongdanva;
      this.load = true;
      let cutid;
      if (ids) {
        cutid = ids;
      } else {
        cutid = this.actid;
      }
      let data = {};
      if (page) {
        data.pageIndex = page;
      }
      data.insurancesID = this.search1;
      data.organizationunitid = cutid;
      let gongmams = data;
      console.log(gongmams);
      this.post(
        gongmams,
        "services/app/organizationUnit/GetOrganizationUnitStaffs"
      ).then(cs => {
        if (cs.success == true) {
          console.log("111111111111111111111");
          console.log(cs);
          this.load = false;
          this.list = cs.result.items;
          console.log("success");
          console.log(this.list);
          for (var i = 0; i < this.list.length; i++) {
            this.list[i].contentname =
              this.list[i].insuranceCode + "/" + this.list[i].staffAccountName;
            if (this.list[i].insuranceCode) {
              this.list[i].contentname =
                this.list[i].insuranceCode +
                "/" +
                this.list[i].staffAccountName;
            } else {
              this.list[i].contentname = this.list[i].staffAccountName;
            }
          }
          // console.log(cs.result.items);
          this.gonghaoPage = cs.result.totalCount;
          console.log(this.gonghaoPage);
          console.log("-----------------------------------------////");
          if (page) {
            this.gonghaoCurrent = page;
          } else {
            this.gonghaoCurrent = 1;
          }
        }
      });
    },
    //直属人员接口方法
    yonghulist(page, ids) {
      let searchs = this.serachkeys;
      this.load = true;
      let cutid;
      if (ids) {
        cutid = ids;
      } else {
        cutid = this.actid;
      }
      let data = {};
      if (page) {
        data.pageIndex = page;
      }
      data.insurancesID = this.search1;
      data.organizationunitid = cutid;
      data.serachkey = this.userSearch;
      console.log(searchs);
      let yongmams = data;
      this.post(
        yongmams,
        "services/app/organizationUnit/GetOrganizationUnitUsers"
      ).then(ds => {
        if (ds.success == true) {
          this.load = false;
          this.chartow = ds.result.items;
          this.yonghuPage = ds.result.totalCount;
          this.mingxi.memberCount = ds.result.totalCount;
          if (page) {
            this.yonghuCurrent = page;
          } else {
            this.yonghuCurrent = 1;
          }
        }
      });
    },
    groupList() {
      let all = {
        letter: "",
        insurances: [{ insuranceName: "全部保险公司", id: "" }]
      };
      let params = {
        // id:val,
      };
      this.post(params, "services/app/common/GetGroupInsurances").then(re => {
        if (re.success) {
          this.items = re.result.items;
          let result = re.result.items;
          result.unshift(all);
          console.log(result);
          this.options1 = result;
        }
      });
    },
    search() {
      this.gonghaolist(1);
    },
    search2() {
      //userSearch
      this.yonghulist(1, this.userSearch);
    },
    search3() {
      //userSearch
      this.yewulist(1, this.userSearch);
    },
    getProvices() {
      const that = this;
      const params = {};
      this.post(params, "services/app/Common/GetRegions").then(rs => {
        // console.log(rs.result)
        // console.log('----------------');
        if (rs.success) {
          for (let i = 0; i < rs.result.items.length; i++) {
            rs.result.items[i].children = [];
          }
          that.provices = rs.result.items;
          that.options2 = rs.result.items;
          // console.log(that.options2);
        }
      });
    },
    // 市
    getCities(val) {
      const that = this;
      const params = {
        id: val[0]
      };
      this.post(params, "services/app/Common/GetRegions").then(rs => {
        // console.log(rs.result)
        // console.log('//////////111111111')

        if (rs.success) {
          for (let i = 0; i < rs.result.items.length; i++) {
            rs.result.items[i].children = [];
          }
          let provice = that.provices;
          provice.forEach(item => {
            if (item.key == val[0]) {
              item.children = rs.result.items;
            }
          });
          that.options2 = provice; // 省，市
          that.cities = rs.result.items;
        }
      });
    },
    // 区
    getAreas(val) {
      const that = this;
      const params = {
        id: val[1]
      };
      this.post(params, "services/app/Common/GetRegions").then(rs => {
        // console.log(rs.result)
        if (rs.success) {
          let city = that.cities;
          let provice = that.provices;
          city.forEach(item => {
            if (item.key == val[1]) {
              item.children = rs.result.items; //市，区
            }
          });
          provice.forEach(p => {
            if (p.key == val[0]) {
              p.children = city;
            }
          });
          that.options2 = provice;
          that.areas = rs.result.items;
        }
      });
    },
    //组织机构
    getUnits() {
      let params = [];
      this.post(params, "services/app/common/GetOrganizationUnits").then(rs => {
        console.log(rs);
        if (rs.success) {
          let units = rs.result;
          // console.log(units);
          this.units = units;
        }
      });
    },
    unitChange(val) {
      console.log(val);
      // let ids = val[val.length - 1];
      // console.log(ids);
      // this.formLabel.parentDisplayName = ids;
      this.formLabel.parentId = val;
    },
    //业务类型
    business() {
      let sele2 = {
        id: 9001
      };
      this.post(sele2, "services/app/common/GetDictionaries").then(rs => {
        this.businessTypeNames = rs.result.items;
        // console.log(this.businessTypeNames)
      });
    },

    toEdit() {
      //	this.dialogVisible = true;
      this.isnew = "2";
      this.layerTitle = "编辑组织信息";
      const me = this;
      console.log(this.mingxi)
      //  this.formLabel = this.mingxi;
      this.formLabel = Object.assign({}, {}, this.mingxi);
      me.dialogVisible = true;

    },
    edityewu() {
      const me = this;
      this.editDetail = this.yewuDetail;
      me.bianjiyewu = true;
      console.log(this.$refs)
      // this.$refs["editDetail"].resetFields();
    },
    gonghaoChange(val) {
      this.gonghaolist(val,this.userSearch);
      //工号分页点击
    },
    yonghuChange(val) {
      //用户分页点击
      this.yonghulist(val,this.userSearch);
    },
    yewuChange(val) {
      //用户分页点击
      this.yewulist(val,this.userSearch);
    },
    closeDialog(formName) {
      //关闭弹层
      this.dialogZhiShu = false;
      this.dialogVisible = false;
      this.dialogAdd = false;
      this.dialogEdit = false;
      this.bianjiyewu = false;
      this.dialogYewu = false;
      this.dialogUser = false;
      console.log(this.$refs)
      this.$refs[formName].resetFields();
    },
    add() {
      this.$router.push({
        name: "adduser",
        query: {
          id: this.userid
        }
      });
    },
    //保险公司
    getins() {
      let params = {};
      let all = { id: "", insuranceName: "全部保险公司" };
      this.post(params, "services/app/common/GetInsurances").then(rs => {
        if (rs.success) {
          let result = rs.result.items;
          result.unshift(all);
          this.baolist = result;
        }
      });
    },
    //从业务团队详情返回上级机构
    backTeam() {
     
      this.visibility = false;
      this.guanli = false;
      setTimeout(() => {
        this.childshow = false;
      }, 1000);
      this.yewulist(this.yewuCurrent,this.userSearch);
    },
    //添加录单员账号
    teamAdd(bid) {
      this.addForm = Object.assign({}, this.addForm, {
        belongOrganizationUnitId: bid,
        policyPermission: 0
      });
      this.dialogAdd = true;
    },
    yonghuAdd(id){
      console.log(id)
      this.zhiShuForm = Object.assign(
          {},
          {},
          {
          isActive: true,
          belongOrganizationUnitId: id,
          shouldChangePasswordOnNextLogin: true
          }
        );
      console.log(this.zhiShuForm)
      this.dialogZhiShu = true
    },
    closeAdd() {//关闭录单员dialog
      this.addForm = Object.assign(
        {},
        {},
        {
          isActive: true,
          shouldChangePasswordOnNextLogin: true
        }
      );
    },
    closeJigou(){
      this.formLabel = Object.assign(
        {},
        {},
        {
          isActive: true,
        }
      );
    },
    //编辑录单员账号
    teamEdit(id, unitid) {
      this.post({ id: id }, "services/app/user/GetUserDetail").then(res => {
        console.log(res);
        if (res.success) {
          this.dialogEdit = true;
          //this.editForm = res.result;
          this.editForm = Object.assign({}, res.result, {
            belongOrganizationUnitId: unitid,
            policyPermission: 0
          });
          console.log(this.editForm);
        }
      });
    },
    //直属人员详情
    userView(id) {
      this.post({ id: id }, "services/app/user/GetUserDetail").then(res => {
        console.log(res);
        if (res.success) {
          this.dialogUser = true;
          //this.editForm = res.result;
          this.userForm = res.result;
        }
      });
    },
    //添加业务团队
    addyewu(parentid) {
      this.formTeam = Object.assign(
        {},
        {},
        {
          isActive: true,
          businessType: "02ab5e71-5e84-4508-9715-9e5b1fe74ed0",
          parentId: parentid,
          shouldChangePasswordOnNextLogin: true
        }
      );

      this.dialogYewu = true;
      //this.$refs['formTeam'].resetFields();
    },
    //业务团队新建编辑保存
    saveTeam(formName) {
      console.log(this.$refs[formName]);

      let params = this.formTeam;
      const that = this;
      this.$refs[formName].validate(valid => {
        console.log("66666");
        if (valid) {
          console.log("懂事了看撒娇来得及撒大声地");
          this.teamLoading = true;
          if (params.email == "") {
            params.email = null;
          }
          this.post(
            params,
            "services/app/organizationUnit/CreateBussOrganizationUnit"
          ).then(rs => {
            if (rs.success) {
              this.$notify({
                title: "成功",
                type: "success",
                message: "业务团队新建成功",
                customClass: "el-notification-success"
              });
              this.yewulist();
              this.handleCommand()
              this.dialogYewu = false;
              that.teamLoading = false;
            } else {
              that.teamLoading = false;
              this.$notify.error({
                title: "错误",
                message: rs.error.message
              });
            }
          });
        } else {
          console.log("error submit");
          return false;
        }
      });
    },
    //验证账号是否重复
    ExistUserName(val, txt) {
      this.post(
        { userName: val },
        "services/app/organizationUnit/ExistUserName"
      ).then(res => {
        if (res.success) {
          // this.$alert(txt + "账号已存在", "", {
          //   confirmButtonText: "确定",
          //   type: "error"
          // });
          return true;
        }
      });
    },
    //直属业务团队列表
    yewulist(page, keyWord) {
      let parmas = {
        organizationId: this.mingxi.id,
        pageIndex: page,
        keyWord: keyWord
      };
      this.post(
        parmas,
        "services/app/organizationUnit/GetRecordOrganizations"
      ).then(res => {
        if (res.success) {
          this.yewu = res.result.items;
          this.yonghuPage2 = res.result.totalCount;
          this.mingxi.businessTeamCount = res.result.totalCount;
          if(page){
            this.yewuCurrent = page;
          }
        }
      });
    },
    //打开业务团队详情
    teamInfo(id) {
      this.detailIDOnly = id;
      
      let yewuId = {
        id: id
      };
      this.childshow = true;
      setTimeout(() => {
        this.visibility = true;
      }, 200);
      setTimeout(() => {
        this.guanli = true;
      }, 1000);
      this.post(
        yewuId,
        "services/app/organizationUnit/GetOrganizationUnitsDetails"
      ).then(res => {
        console.log(res.result);
        if (res.success) {
          this.yewuDetail = res.result;
          this.yewuDetailID = res.result.id;
          this.recorderForm = res.result.recorderAccount;
          // this.tab = '2'
        }
      });
      this.yewuGhlist(1, id);
      // this.teamshow = true; //弃用
      // let params ={
      //   id:id
      // }
      //  this.post( parmas,"services/app/organizationUnit/GetRecordOrganizations").then(res => {
      //   if (res.success) {
      //     this.yewu = res.result.items;
      //   }
      // });
    },
    //业务团队出单工号下拉change
    ywtafflist(val) {
      this.yewuGhlist(1, this.yewuDetail.id, val);
    },
    //业务团队出单工号分页
    ywghChange(val) {
      this.yewuGhlist(val,this.yewuDetail.id);
    },
    //业务团队出单工号列表

    yewuGhlist(page, id, search) {
      this.kyload = true;
      let params = {
        organizationunitid: id,
        pageIndex: page,
        insurancesID: search
      };
      this.post(
        params,
        "services/app/organizationUnit/GetOrganizationUnitStaffs"
      ).then(rs => {
        if (rs.success == true) {
          this.kyload = false;
          this.yewuGhdata = rs.result.items;
          // for (var i = 0; i < this.list.length; i++) {
          //   this.list[i].contentname =
          //     this.list[i].insuranceCode + "/" + this.list[i].staffAccountName;
          //   if (this.list[i].insuranceCode) {
          //     this.list[i].contentname =
          //       this.list[i].insuranceCode +
          //       "/" +
          //       this.list[i].staffAccountName;
          //   } else {
          //     this.list[i].contentname = this.list[i].staffAccountName;
          //   }
          // }
          // console.log(cs.result.items);
          this.ywghPage = rs.result.totalCount;
          if (page) {
            this.ywghCurrent = page;
          } else {
            this.ywghCurrent = 1;
          }
        } else {
          this.$notify.error({
            title: "错误",
            message: rs.error.message
          });
        }
      });
    },
    //负责人更改密码
    changePassword(formName, val) {
      let params = {
        userId: this.yewuDetail.chargerID,
        newPassword: this.fzrForm.chargerNewPassword,
        shouldChangePasswordOnNextLogin: this.fzrForm.chargerIstrue
      };
      this.$refs[formName].validate(valid => {
        if (valid) {
          this.post(params, "services/app/user/ChangePassword").then(res => {
            console.log(res.result);
            if (res.success) {
              this.$notify({
                title: "成功",
                type: "success",
                message: "修改密码成功",
                customClass: "el-notification-success"
              });

              this.$refs[val].doClose();
            } else {
              this.$notify.error({
                title: "错误",
                message: res.error.message
              });
            }
          });
        } else {
          console.log("error submit");
        }
      });
    },
    //录单员人更改密码
    ludanPassword(formName, val, index,id) {

      let params = {
        userId: id,
        newPassword: this.ldyForm.chargerNewPassword,
        shouldChangePasswordOnNextLogin: this.ldyForm.chargerIstrue
      };

      this.$refs[formName][index].validate(valid => {
        if (valid) {
          this.post(params, "services/app/user/ChangePassword").then(res => {
            console.log(res.result);
            if (res.success) {
              this.$notify({
                title: "成功",
                type: "success",
                message: "修改密码成功",
                customClass: "el-notification-success"
              });

              this.$refs[val][0].doClose();
              this.ldyForm.chargerNewPassword = ''
            } else {
              this.$notify.error({
                title: "错误",
                message: res.error.message
              });
            }
          });
        } else {
          console.log("error submit");
        }
      });
    },
    //录单员密码
    savePop() {},
    //新建录单员账号
    CreateOrUpdateUser(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          // console.log(form)
          // console.log(this.addForm)

          this.teamLoading = true;
 var assignedRoleIds = []
          if(formName == 'addForm'){
            var user = this.addForm;
            Vue.set(user,'isActive',true)
            this.addForm.belongOrganizationUnitId = this.yewuDetailID;
            var man = true
          }else{
            var user = this.zhiShuForm;
            Vue.set(user,'isActive',true)
            var man = false;
            assignedRoleIds.push(this.zhiShuForm.assignedRoleIds)
          }
         
          // if (user.emailAddress == "") {
          //   user.emailAddress = null;
          // }
         
          let params = {
            user: user,
            assignedRoleIds: assignedRoleIds,
            IsSalesman: man
          };
          this.post(params, "services/app/user/CreateOrUpdateUser").then(
            res => {
              console.log(res);
              if (res.success) {
                this.$notify({
                  title: "成功",
                  type: "success",
                  message: "新建人员成功",
                  customClass: "el-notification-success"
                });
                this.teamLoading = false;
                
                 if(formName == 'addForm'){
                     this.teamInfo(this.detailIDOnly);
                     this.dialogAdd = false;
                    
                 }else{
                    this.yonghulist()
                    this.dialogZhiShu = false;
                 }
                  this.closeDialog(formName)
              } else {
                this.teamLoading = false;
                this.$notify.error({
                  title: "错误",
                  message: res.error.message
                });
              }
              // recorderAccount
            }
          );
        } else {
          console.log("error submit");
          return false;
        }
      });
    },
    GetList() {
      let params = {};
      this.post(
        params,
        "services/app/organizationUnit/GetOrganizationUnitStaffs"
      ).then(res => {
        console.log(res);
      });
    },
    //编辑录单员保存
    saveEdit(formName) {
      this.editLoading = true;
      const that = this;
      this.editForm.password = "";
      let params = {
        user: {
          name: this.editForm.name,
          id: this.editForm.id,
          isActive: this.editForm.isActive,
          phoneNumber: this.editForm.phoneNumber,
          emailAddress: this.editForm.emailAddress,
          identityCard: this.editForm.identityCard,
          policyPermission: this.editForm.policyPermission,
          belongOrganizationUnitId: this.yewuDetailID
        },
        IsSalesman: 1
      };
      console.log(params);
      this.$refs[formName].validate(valid => {
        if (valid) {
          this.post(params, "services/app/user/CreateOrUpdateUser").then(
            res => {
              if (res.success) {
                this.$notify({
                  title: "成功",
                  type: "success",
                  message: "录单员编辑成功",
                  customClass: "el-notification-success"
                });
                this.dialogEdit = false;
                that.editLoading = false;
              } else {
                that.editLoading = false;
                this.$notify.error({
                  title: "错误",
                  message: res.error.message
                });
              }
            }
          );
        } else {
          console.log("error submit");
          return false;
        }
      });
    },
    //人员详情保存
    saveUser(formName) {
      const that = this;
      let params = {
        user: {
          name: this.userForm.name,
          id: this.userForm.id,
          isActive: this.userForm.isActive,
          phoneNumber: this.userForm.phoneNumber,
          emailAddress: this.userForm.emailAddress,
          identityCard: this.userForm.identityCard,
          policyPermission: this.userForm.policyPermission,
          belongOrganizationUnitId: this.userForm.belongOrganizationUnitId
        },
        isSalesman: false,
        assignedRoleIds: [this.userForm.roleId]
      };
      console.log(params);
      this.$refs[formName].validate(valid => {
        if (valid) {
           this.editLoading = true;
          this.post(params, "services/app/user/CreateOrUpdateUser").then(
            res => {
              if (res.success) {
                this.$notify({
                  title: "成功",
                  type: "success",
                  message: "人员编辑成功",
                  customClass: "el-notification-success"
                });
                this.dialogUser = false;
                that.editLoading = false;
                that.yonghulist(1, that.mingxi.id);
              } else {
                that.editLoading = false;
                this.$notify.error({
                  title: "错误",
                  message: res.error.message
                });
              }
            }
          );
        } else {
          console.log("error submit");
          return false;
        }
      });
    },
    //关闭修改密码弹层
    cloaseRecorder(val) {
      // debugger
      //let recor = 'recorder'+val+''
      this.$refs[val].doClose();
    },
    //编辑业务团队
    saveEdityewu(formName) {
      const that = this;
      let params = {
        id: this.editDetail.id,
        displayName: this.editDetail.displayName,
        organizationCode : this.editDetail.organizationCode ,
        charger: this.editDetail.charger,
        address: this.editDetail.address,
        phoneNumber: this.editDetail.phoneNumber,
        remarks: this.editDetail.remarks,
        identityCard: this.editDetail.identityCard,
        email: this.editDetail.email == "" ? null : this.editDetail.email,
        isActive:true
      };
      this.$refs[formName].validate(valid => {
        if (valid) {
          this.editLoading = true;
          this.post(
            params,
            "services/app/organizationUnit/UpdateOrganizationUnit"
          ).then(res => {
            if (res.success) {
              this.$notify({
                title: "成功",
                type: "success",
                message: "业务团队编辑成功",
                customClass: "el-notification-success"
              });
              this.bianjiyewu = false;
              that.editLoading = false;
              this.teamInfo(this.editDetail.id);
            } else {
              that.editLoading = false;
              this.$notify.error({
                title: "错误",
                message: res.error.message
              });
            }
          });
        } else {
          console.log("error submit");
          return false;
        }
      });
    },
    closePop(val) {
      console.log(this.$refs);
      this.ldyForm = Object.assign({},{},{
        chargerIstrue:true
      })
      this.$refs[val][0].doClose();
    },
    canclePwd(){
      this.onePwd =false;
      this.fzrForm= Object.assign({},{},{
        chargerIstrue:true
      })
    },
    loadrole() {
      //角色
      const me = this;
      //let all = { id: "", displayName: "全部角色" };
      let params = {};
      this.post(params, "services/app/common/GetRoles").then(rs => {
        console.log(rs);

        if (rs.success) {
          let result = rs.result.items;
          //  result.unshift(all);
          this.rolelist = result;
          this.setRoleList = result;
        }
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.wd593 {
  width: 593px;
}
.wdall {
  width: 538px;
}
.toCenter {
  text-align: center;
}
.unit-menu {
  .is-opened {
    .icon-jianqu {
      display: block;
    }
    .icon-tianjia {
      display: none;
    }
  }
}
.unit-edit {
  float: right;
  margin: 14px 34px 0 0;
  .el-button--mini,
  .el-button--small {
    font-size: 12px !important;
  }
}
.unit-zong {
  height: 100%;
  // border-radius: 3px;
  position: relative;
  // border: 1px solid #ddd;
  // min-height: 800px;
  padding-left: 210px;
  .unit-left {
    width: 210px;
    height: 100%;
    background-color: #f6f6f6;
    position: absolute;
    top: 0;
    left: 0;
    padding-top: 40px;
    // overflow-y: auto;
    // overflow-x: hidden;
    .unit-scroll {
      position: absolute;
      top: 40px;
      left: 0;
      height: calc(100% - 40px);
      width: 100%;
      overflow-y: auto;
      padding-bottom: 95px;
    }
    a {
      color: #111;
      text-decoration: none !important;
      cursor: pointer;
    }
    .unit-left-top {
      height: 40px;
      line-height: 40px;
      color: #333;

      cursor: pointer;
      i {
        z-index: 2;
        // display: none;
      }
    }
    .unit-left-top:hover {
      .unit-zong-txt {
        background: #fff;
      }
    }
    .unit-zong-txt {
      width: 100%;
      height: 40px;
      padding-left: 17px;
      padding-right: 15px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      border-bottom: 1px solid #ddd;
    }

    .unit-left-li {
      position: relative;
      i {
        line-height: 1;
        //z-index: 2;
      }
      .icon-tianjia,
      .icon-jianqu {
        position: absolute;
        left: 35px;
        top: 13px;
        color: #aeaeae;
        line-height: 1;
      }
      .icon-xinjian {
        position: absolute;
        right: 28px;
        top: 14px;
      }
      .icon-act {
        color: #ee6000;
      }
      .unit-ltetp {
        cursor: pointer;
        height: 40px;
        padding-left: 63px;
        position: relative;
        line-height: 40px;
        border-bottom: 1px solid #ddd;
      }
      .unit-ltetp:hover {
        background: #f0f0f0;
      }
      .active,
      .active:hover {
        background: #fff;
        color: #ee6000;
      }
      .active::after {
        height: 40px;
        width: 4px;
        background: #ff7819;
        position: absolute;
        left: 0;
        top: 0;
        display: block;
        z-index: 3;
        content: "";
      }
    }
    .unit-left-li-two {
      .unit-ltetp {
        padding-left: 79px;
      }
      .icon-tianjia,
      .icon-jianqu {
        left: 51px;
      }
    }
    .unit-left-li-three {
      .unit-ltetp {
        padding-left: 96px;
      }
      .icon-tianjia,
      .icon-jianqu {
        left: 68px;
      }
    }
    .unit-left-li-four {
      .unit-ltetp {
        padding-left: 96px;
      }
    }
  }

  .unit-right {
    // float: left;
    min-width: 790px;
    // height: 900px;
    width: 100%;
    background: #fff;
    border-left: 1px solid #ddd;
    // box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    position: relative;
    padding-bottom: 20px;
    overflow: hidden;
    //z-index: 2;
    .unit-rtop {
      width: 100%;

      .unit-toptop {
        width: 100%;
        height: 60px;
        padding-left: 40px;
        box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1);
        .unit-topbiao {
          font-size: 18px;
          line-height: 60px;
          color: #333;
          .iconfont {
            color: #ff9430;
          }
        }

        .btn-group {
          float: right;
          margin-right: 34px;
          margin-top: 14px;
        }
        .unit-toptopbutton {
          display: inline-block;
          width: 44px;
          height: 26px;
          line-height: 26px;
          border: none;
          border-radius: 3px;
          color: #fff;
          float: right;
          margin: 17px 20px 0 0;
        }
      }

      .unit-topbot {
        width: 100%;

        .unit-shou {
          width: 100%;
          .unit-toptext1 {
            float: left;
            width: 330px;
            // height: 200px;
            padding-left: 60px;
            padding-top: 10px;
            table tr {
              height: 30px;
              line-height: 32px;
              .unit-td1 {
                color: #b7b7b7;
              }
              .unit-td2 {
                margin-left: 20px;
                display: block;
                color: #555555;
              }
            }
          }
          .unit-toptext2 {
            float: left;
            width: 330px;
            // height: 200px;
            padding-left: 40px;
            padding-top: 10px;
            table tr {
              height: 25px;
              line-height: 32px;
              .unit-td1 {
                color: #b7b7b7;
              }
              .unit-td2 {
                margin-left: 20px;
                display: block;
                color: #555555;
              }
            }
          }
          .unit-toptext3 {
            width: 100%;
            // height: 54px;
            padding: 11px 20px;
            border-bottom: 1px solid #efefef;
            color: #5c9ecb;
            background-color: #eaf5fb;
          }
        }
        .unit-shoubu {
          width: 100%;
          height: 50px;
          line-height: 20px;
          color: dodgerblue;
          padding-left: 10px;
          cursor: pointer;
          border-top: 1px solid #111;
          margin-top: 10px;
        }
      }
    }
    .unit-rbottom {
      width: 100%;
      // height: 600px;
      .unit-tabs {
        width: 100%;
        padding: 0 35px;
        border-bottom: 1px solid #f1f1f1;
        height: 47px;
        .unit-tabsli {
          cursor: pointer;
          float: left;
          padding: 13px 10px 14px;
          margin-right: 40px;
          line-height: 20px;
          font-size: 14px;
          color: #333;
          span {
            color: #ff0000;
          }
        }
        .unit-tabs-act {
          color: #ee6000;
          background: url(../../assets/images/bomactive2x.png) bottom center
            no-repeat;
          span {
            color: #ee6000;
          }
        }
      }
      .unit-rbotext {
        width: 100%;
        // min-height: 550px;
        position: relative;
        .unit-rbotext1 {
          width: 100%;
          .unit-rbotextsou {
            width: 100%;
            padding: 20px 35px 0px;
            background-color: #fff;

            .unit-search {
              float: left;
            }
            .unit-sbtn {
              margin-left: 15px;
              float: left;
            }
            .unit-gbtn {
              float: right;
            }
            .unit-rbotextsoubu1 {
              width: 48px;
              height: 28px;
              line-height: 28px;
              border-radius: 3px;
              border: 1px solid #aeaeae;
              background-color: #fff;
              color: #666666;
              margin: 7px 0 0 15px;
            }
            .unit-rbotextsoubu2 {
              width: 102px;
              height: 28px;
              line-height: 28px;
              border-radius: 3px;
              border: 1px solid #ff7819;
              color: #ff7819;
              margin-top: 18px;
              background-color: #fff;
              float: right;
              margin-right: 30px;
            }
          }
        }
        .unit-table {
          padding: 0 35px;
        }
        .unit-rbotext2 {
          width: 100%;
          height: 550px;
          position: absolute;
          top: 50;
          left: 0;
          .unit-rbotextsou {
            width: 100%;
            height: 64px;
            padding-left: 35px;
            background-color: #fff;
            input {
              width: 250px;
              height: 28px;
              line-height: 30px;
              border-radius: 1px;
              border: 1px solid #ebecee;
              margin-top: 18px;
              appearance: none;
              -moz-appearance: none;
              -webkit-appearance: none;
            }
            .unit-rbotextsoubu3 {
              width: 48px;
              height: 28px;
              line-height: 28px;
              border-radius: 3px;
              border: 1px solid #aeaeae;
              background-color: #fff;
              color: #666666;
              margin: 7px 0 0 15px;
            }
            .unit-rbotextsoubu4 {
              width: 102px;
              height: 28px;
              line-height: 28px;
              border-radius: 3px;
              border: 1px solid #ff7819;
              color: #ff7819;
              background-color: #ffffff;
              margin-top: 18px;
              float: right;
              margin-right: 30px;
            }
          }
        }
      }
    }
  }

  .layer-wrap .layer-box {
    background-color: #f2f2f2;
    height: 450px;
  }
}
.unit-zong::after {
  clear: both;
  height: 0;
  display: block;
  content: "";
}

.ceshi6 {
  background: #eb3d44;
}
.unit-dianjia {
  margin-left: 10px;
  color: #ff7819;
}

.unit-bianse1 {
  width: 158px;
  float: right;
  border: 1px solid #a1a1a1;
}
.unit-bianse1 .util-select {
  width: 158px;
}
.unit-bianse1 .util-select .util-select-box {
  width: 154px;
  border: none;
}
.unit-bianse1 .util-select-box {
  width: 158px;
}

.dicon {
  margin-left: 19px;
  margin-right: 13px;
  font-size: 14px !important;
}
.dtoicon {
  margin-left: 35px;
  margin-right: 13px;
  font-size: 14px !important;
}
.dtreeicon {
  margin-left: 51px;
  margin-right: 13px;
  font-size: 14px !important;
}
.dfouricon {
  margin-left: 67px;
  margin-right: 13px;
  font-size: 14px !important;
}
.dtianjia {
  font-size: 14px !important;
}

.dianjix1 {
  background-color: #feeddd;
  color: #fe974d !important;
  a {
    color: #fe974d !important;
  }
}

/**/
.unit-tanp1 {
  width: 48%;
  height: 28px;
  line-height: 28px;
  margin: 10px 0;
  float: left;
  .unit-tansapan {
    width: 116px;
    display: inline-block;
    float: left;
    text-align: right;
  }
  .unit-tanin {
    width: 158px;
    height: 28px;
    line-height: 28px;
    border: 1px solid #a1a1a1;
    float: right;
    background-color: #fff;
  }
}
.unit-tanp2 {
  width: 100%;
  height: 28px;
  line-height: 28px;
  margin: 10px 0;
  float: left;
  .unit-tansass {
    width: 116px;
    height: 28px;
    line-height: 28px;
    float: left;
  }
  .unit-taninchang {
    width: 440px;
    height: 28px;
    line-height: 28px;
    border: 1px solid #a1a1a1;
    float: left;
  }
}

.unit-lay-form {
  width: 100%;
  .unit-row {
    width: 100%;
    display: flex;
    padding-bottom: 25px;
    .unit-col {
      flex: 1;
      position: relative;
      height: 28px;
      padding-left: 120px;
      .unit-col-lab {
        position: absolute;
        left: 0;
        top: 0;
        width: 120px;
        text-align: right;
        line-height: 28px;
        padding-right: 10px;
      }
      .unit-col-input {
        width: 100%;
        height: 28px;
        text-align: left;
        position: relative;
        .unit-sheng {
          float: left;
          margin-right: 20px;
        }
      }
    }
  }
}
.unit-cent {
  padding: 21px 60px 12px;
  .unit-row {
    width: 100%;
    margin-bottom: 12px;
    display: flex;
    .unit-text {
      flex: 1;
      line-height: 18px;
      .unit-label {
        color: #666;
        float: left;
      }
      .unit-info {
        color: #333;
        float: left;
      }
    }
  }
  .unit-remark {
    background: #eaf5fb;
    width: 100%;
    height: 40px;
    line-height: 40px;
    padding: 0 20px;
    font-family: PingFangSC-Regular;
    font-size: 13px;
    color: #5c9ecb;
    margin-top: 8px;
  }
}
.unit-tbox {
  padding: 20px 35px 0 35px;
  width: 100%;
  min-height: 500px;
}

.unit-sbtn {
  margin-left: 15px;
}
.unit-gl {
  float: right;
}
.unit-page {
  margin-top: 30px;
  text-align: right;
}
.drop-text {
  width: 110px;
  text-align: left;
  padding-left: 7px;
  color: #666;
  font-size: 13px;
  height: 28px;
  line-height: 28px;
}
/*滚动条*/
.unit-left::-webkit-scrollbar {
  width: 8px;
}
.unit-left::-webkit-scrollbar-track {
  background-color: transparent;
}

.unit-left::-webkit-scrollbar-thumb {
  background-color: rgba(144, 146, 152, 0.5);
  border-radius: 10px;
}

.unit-left::-webkit-scrollbar-button {
  background-color: transparent;
}

.unit-left::-webkit-scrollbar-corner {
  background-color: transparent;
}
.unit-tops {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 40px;
  line-height: 40px;
  padding: 0 17px;
  color: #333;
  border-bottom: 1px solid #e8e8e8;
  .unit-red {
    color: #eb3d44;
    padding: 0 4px;
  }
}
.let-drop {
  position: absolute;
  right: 28px;
  top: 9px;
  line-height: 1;
  display: none;
}
.unit-left-li:hover {
  .changebtn {
    display: block;
  }
}
.drop-menu-text {
  width: 100px;
  padding: 0 7px;
}
.el-dropdown-menu__item:not(.is-disabled):hover {
  color: #606266;
}
/*.el-btn-edit{height: 28px;overflow: hidden;}*/
.el-button.el-button--primary.el-button--mini.el-dropdown__caret-button {
  height: 28px !important;
  overflow: hidden;
}
.changebtn {
  width: 59px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  display: none;
  position: absolute;
  right: 0;
  top: 0;
  .icon-xiala {
    border: 1px solid #999999;
    color: #999999;
    border-radius: 3px;
  }
  .dropdown {
    display: none;
    position: absolute;
    width: 100px;

    min-height: 31px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 5px 7px 0 rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    background: #ffffff;
    right: 0;
    top: 40px;
    z-index: 33;
    p {
      text-align: center;
      font-size: 13px;
      color: #666666;
      line-height: 31px;
      margin: 0;
      padding: 0 7px;
      cursor: pointer;
    }
    p:not(:last-of-type) {
      border-bottom: 1px solid #dddddd;
    }
  }
}
.changebtn:hover .dropdown {
  display: block;
}
.dropdown > p:hover {
  background-color: #ecf5ff;
}
.unit-team {
  min-width: 100%;
  min-height: 100%;
  background: #fff;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  transform: translateX(100%);
  transition: all cubic-bezier(0.22, 0.61, 0.36, 1) 1s;

  // box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  // padding: 0 0 20px 0;
}
.team-show {
  transform: translateX(0);
}
.position {
  position: relative;
}
.unit-status {
  display: inline-block;
  width: 50px;
  height: 23px;
  border-radius: 3px;
  color: #fff;
  background: #389e0d;
  font-size: 12px;
  line-height: 23px;
  text-align: center;
  margin-left: 10px;
}
.unit-false {
  background: #999;
}
.unit-teamtitle {
  padding: 18px 35px 0 35px;
  .unit-tabsli {
    float: left;
    line-height: 28px;
    font-size: 14px;
    color: #333;
    span {
      color: #f00;
    }
  }
  .unit-team-select {
    width: 180px;
    float: left;
    margin-left: 30px;
  }
}
.mg15 {
  margin-right: 15px;
}
.unit-teamname {
  font-size: 18px;
  color: #000;
  font-weight: 700;
  padding-left: 10px;
}
.editPwd {
  color: #027dca;
}
.unit-pwd {
  padding: 8px 8px 20px;
}
.team-foot {
  text-align: center;
  margin-top: 8px;
}
.teamshow {
  overflow: initial !important;
}
.icon-icon01 {
  vertical-align: middle;
}
</style>

